import java.util.Scanner;

public class GuessNumber {

    public static void main(String[] args) {
        while (true){
            int answer = (int)(Math.random() * 100) + 1;
            Scanner scan = new Scanner(System.in);
            int times = 0;
            int guess = 0;
            while (times < 7){
                System.out.println("请整一个1~100的数：");
                guess = scan.nextInt();
                times = times + 1;

                if (guess < answer){
                    System.out.println("有点儿小。");
                }else if(guess > answer){
                    System.out.println("有点儿大。");
                }else {
                    System.out.println("芜湖！这回对了！");
                    break;
                }
            }
            if (times == 7 && answer != guess){
                System.out.println("可惜，可惜，没机会咯！~");
            }
            System.out.println("再来一次吗？？？？（y/n）");
            String choice = scan.next();
            if (!choice.equalsIgnoreCase("y")){
                break;
            }
        }

    }
}
